using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;

namespace jivemessenger
{
    class JiveServiceConnection : Java.Lang.Object, IServiceConnection
    {
        public event EventHandler<JiveServiceConnectEventArgs> ServiceConnectionChangedEvent;
        //private ActivityGroupChat _activityGroupChat;

        //public JiveServiceConnection(ActivityGroupChat activity)
        //{
        //    //this._activityGroupChat = activity;
        //}
        public void OnServiceConnected(ComponentName name, IBinder service)
        {
            var demoServiceBinder = service as JiveServiceBinder;
            if (demoServiceBinder != null)
            {
                StaticService.Binder = demoServiceBinder;
                StaticService.IsBound = true;
            }
            if (this.ServiceConnectionChangedEvent != null)
                this.ServiceConnectionChangedEvent(this, new JiveServiceConnectEventArgs(false,false));
        }

        public void OnServiceDisconnected(ComponentName name)
        {
            StaticService.IsBound = false;
            if (this.ServiceConnectionChangedEvent != null)
                this.ServiceConnectionChangedEvent(this, new JiveServiceConnectEventArgs(false,false));
        }
    }
}